﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace CLVisionEICS
{
    internal class CLEICSClientFactory
    {
        private volatile static  ICLEICSClient mqttMesClient = null;

        private static object o = new object(); 
        public static ICLEICSClient CreateMQTTClient()
        {
           
            if (mqttMesClient == null)
            {
                lock (o)
                {
                    if (mqttMesClient == null)
                    {
                        mqttMesClient = new CLEICSClient();
                    }
                }
            }


            ///////************************  判断参数是NC还是TS  ****************************
            ////当前类的类型
            //Type type = typeof(CLEICSClientFactory);
            ////获取dll的当前路径
            //string path = type.Assembly.Location;
            ////dll所在文件夹
            //string currentDirPath = Path.GetDirectoryName(path);

            //if (currentDirPath.Contains("Ncheck"))  //路径含有Ncheck是NC
            //{
            //    mqttMesClient = new MqttMesClientNC();
            //}
            //else if (currentDirPath.Contains("V:\\Std\\OMS\\TestSteps"))
            //{
            //    mqttMesClient = new MqttMesClientTS();
            //}

            return mqttMesClient;
        }
    }
}
